package com.example.peibei.ui.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dingtao.common.bean.Square;
import com.dingtao.common.util.GlideUtils;
import com.example.peibei.R;

import java.util.List;

public class SquareListAdapter extends BaseQuickAdapter<Square.RecordsDTO, BaseViewHolder> {
    public SquareListAdapter(@Nullable List<Square.RecordsDTO> data) {
        super(R.layout.item_square_list_two, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Square.RecordsDTO item) {
        ImageView head = helper.getView(R.id.iv_head);
        GlideUtils.loadImg(getContext(), item.getHeaderUrl(), 20, head);
        helper.setText(R.id.tv_name,item.getCircleName()).setText(R.id.tv_dec,item.getRemarks()).setText(R.id.tv_people,item.getPersonNum());
        TextView tv_follow = helper.getView(R.id.tv_follow);
        TextView tv_cancel_follow = helper.getView(R.id.tv_cancel_follow);
        if (item.isFollow()){
            tv_follow.setVisibility(View.GONE);
            tv_cancel_follow.setVisibility(View.VISIBLE);
        }else{
            tv_follow.setVisibility(View.VISIBLE);
            tv_cancel_follow.setVisibility(View.GONE);
        }
    }
}
